import React, { Component } from 'react'
import IdPannel from '../components/IdPannel'

export default class Detail extends Component {
	constructor(){
		super();
		this.state = {
			user:[
				{
					id:0,
					name: "kimoo",
					gender: "male"
				},
				{
					id:1,
					name: "momo",
					gender: "female"
				},
				{
					id:2,
					name: "zm",
					gender: "male"
				}
			]
		}
	}
  render() {
		let id = Number( this.props.match.params.id );
		// console.log( typeof id )
		let data = this.state.user.find(item=>item.id === id);
		return (
			<div>
				<h3>Detail</h3>
				<hr />
				{
					data ? (<dl>
					<dt>用户名:</dt>
					<dd>{data.name}</dd>
					<dt>性别:</dt>
					<dd>{data.gender}</dd>
				</dl>): <div>查无此人</div>
				}
				<IdPannel ></IdPannel>
			</div>
		)
  }
}

